/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.mes.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 生产计划实体类
 *
 * @author liubq
 * @since 2020-09-10
 */
@Data
@TableName("prj_produce_plan")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ProduceSite对象", description = "产线计划")
public class ProducePlan extends BaseEntity {

	private static final long serialVersionUID = 1L;
	@ApiModelProperty(value = "计划编码")
	private String planCode;
	@ApiModelProperty(value = "产品编码")
	private String prodCode;
	@ApiModelProperty(value = "产品名称")
	private String prodName;
	@ApiModelProperty(value = "生产日期")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date prodTime;


	@ApiModelProperty(value = "客户图号")
	private String customCode;
	@ApiModelProperty(value = "班组编码")
	private String workClassCode;
	@ApiModelProperty(value = "班组名称")
	private String workClassName;
	@ApiModelProperty(value = "开始流水号")
	private Long beginIdx;
	@ApiModelProperty(value = "生成数量")
	private Long createNumber;

	public String getStatusValue() {
		Integer status = this.getStatus();
		if (status == null || 0 == status) {
			return "未下发";
		} else if (1 == status) {
			return "已下发";
		} else if (2 == status) {
			return "执行中";
		} else if (15 == status) {
			return "已强制停止";
		} else if (5 == status) {
			return "运行结束";
		} else {
			return "状态异常";
		}
	}
}
